Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netatmo integration #1951

Merged
merged 65 commits into from
Jan 30, 2024
Merged

Conversation

Terdious
Copy link
Contributor

@Terdious Terdious commented Nov 25, 2023

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community (french forum/english forum) for testing before merging.
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Add a new Netatmo integration
OAuth2 authentication management

@Terdious Terdious changed the title Netatmo integration [WIP] Netatmo integration Nov 25, 2023
Copy link

codecov bot commented Nov 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d87cabc) 98.21% compared to head (1bd23da) 98.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1951      +/-   ##
==========================================
+ Coverage   98.21%   98.30%   +0.09%     
==========================================
  Files         800      833      +33     
  Lines       12501    13176     +675     
==========================================
+ Hits        12278    12953     +675     
  Misses        223      223              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

relativeci bot commented Nov 26, 2023

Job #2314: Bundle Size — 9.82MiB (+1.9%).

1bd23da(current) vs d87cabc master#2297(baseline)

Warning

Bundle contains 3 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 2 regressions
                 Current
Job #2314
     Baseline
Job #2297
Regression  Initial JS 5.34MiB(+2.01%) 5.23MiB
Regression  Initial CSS 303.16KiB(+0.2%) 302.56KiB
Change  Cache Invalidation 58% 0%
No change  Chunks 51 51
Change  Assets 164(+1.86%) 161
Change  Modules 1454(+1.25%) 1436
No change  Duplicate Modules 20 20
No change  Duplicate Code 0.8% 0.8%
No change  Packages 124 124
No change  Duplicate Packages 3 3
Bundle size by type  Change 4 changes Regression 4 regressions
                 Current
Job #2314
     Baseline
Job #2297
Regression  JS 7.03MiB (+1.53%) 6.92MiB
Regression  IMG 2.36MiB (+3.32%) 2.28MiB
Regression  CSS 319.67KiB (+0.19%) 319.07KiB
Not changed  Fonts 93.55KiB 93.55KiB
Regression  Other 16.82KiB (+1.92%) 16.5KiB
Not changed  HTML 13.58KiB 13.58KiB

View job #2314 reportView Terdious:netatmo-integration branch activityView project dashboard

@Terdious
Copy link
Contributor Author

Hi @Pierre-Gilles
Couldn't it be beneficial to do a first review for this part which is new (I want to talk in particular about the OAut2 connection).
This would also prevent the review from being too long.
And also for me not to go work on something else if this start is not valid.

Thanks in advance.

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR 🙏

I haven't entirely tested the integration, I just did a first review with what I could test on the UI side + a first code review.

On the functional side

When I first open the integration, here is what I see:

Screenshot 2024-01-11 at 09 54 11

There is an error message immediately (I didn't do anything), which is a bit weird for the user.

Link to the documentation is missing category:
Screenshot 2024-01-11 at 09 54 30

Buttons a bit weird:

Screenshot 2024-01-11 at 09 55 08

On the code side

The code is so much different from when I first had a look 😅

  • There is a major issue with the way the NetatmoHandler works, it seems you are passing the object (itself) to every single function. It's an anti-pattern, you have access to this everywhere.
  • Many files of this class contains several functions. Try to keep 1 file = 1 function when you are building functions of a class (Talking about NetatmoHandler)
  • Some function comments are not explaining what a function does, making the code hard to grasp.
  • See all my comments

Please take some time to review the PR entirely and improve those points before I can do a second review.

This is already a massive PR (+7000 lines of code) so each review is expensive.

@Terdious
Copy link
Contributor Author

Hi @Pierre-Gilles

When I first open the integration, here is what I see:

Screenshot 2024-01-11 at 09 54 11

There is an error message immediately (I didn't do anything), which is a bit weird for the user.

So for now I can't even reproduce your first connection error... Nobody has obviously had the case on the 2 testers and I have just started again with a fresh installation on wsl, I don't have this problem ..., my state first connection :
image

Also test via the docker image, my state first connection :
image
Could you see on your side to guide me?

not very clean, we don't put error message here, it's a menu
image

Ok for the message part in the left banner, it allowed us to have a common visual and removed the repetition aspect and it seems to me that the 2 testers found it clean on the contrary. I withdraw.

Link to the documentation is missing category:
Screenshot 2024-01-11 at 09 54 30

Corrected, my bad !

Buttons a bit weird:

Screenshot 2024-01-11 at 09 55 08

Yes for the button, I wanted things to be clearly expressed. This is not just a matter of saving the modified data, but of having to request new access and therefore go through the Netatmo login page each time you save. I make a proposal in this sense to put a text above. Corrected

There is a major issue with the way the NetatmoHandler works, it seems you are passing the object (itself) to every single function. It's an anti-pattern, you have access to this everywhere.

For the "netatmoHandler" passed around... I guess it's a poor understanding/configuration of my vscode. The “this.” » is declared in eslint error everywhere in my vscode interface, so I passed the 'netatmoHandler' for this reason only. My bad, corrected

Many files of this class contains several functions. Try to keep 1 file = 1 function when you are building functions of a class (Talking about NetatmoHandler)

I understand. Corrected

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes! 🙏

It's way better now :)

I have a few feedbacks on the server side but nothing serious.

On the UI, it looks good to me now! Can you update your documentation PR with new screenshots?

Once everything is fixed, it'll good for merge I think !! 🚀🚀🚀

@Terdious
Copy link
Contributor Author

On the UI, it looks good to me now! Can you update your documentation PR with new screenshots?

I do this before the end of the evening.

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me for this first PR, thanks for this great work 👏👏👏

@Pierre-Gilles Pierre-Gilles merged commit d6dfdc9 into GladysAssistant:master Jan 30, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants